extends ../_layout
block content
   div.container
      div.jumbotron
         h1= 'Say hello to our members ...'
      table.table
         thead.alert.alert-info
            tr
               td= '.'
               td= 'Name'
               td= 'Email'
               td= 'Role'
               td= 'Joined Clubs'
         tbody
            if(users && users.length > 0)
               - each u in users
                  tr
                     td
                        if(u.userdetail)
                           img(src='data:image/jpeg;base64,' + u.userdetail.avatar.bin, width=64, height=64)
                        else
                           img(src='/img/profile-default.jpg', alt='User Profile Photo', width='64', height='64')
                     td: a(href='/users/profile/'+u._id)= u.firstname + ' ' +  u.lastname
                     td= u.local.email
                     td= u.role
                     td
                        if(u.joinedclubs && u.joinedclubs.length > 0)
                           - each c in u.joinedclubs
                              a(href='/clubs/detail/' + c._id)
                                 span.badge= c.name
                              br
                     if(user && user.role && user.role=='admin')
                        td: a(href='/users/profile/edit/' + u._id) Edit


      hr
      a.btn.btn-info(href='/home') Home
